/*
 * Copyright 2010-2012 Susanta Tewari. <freecode4susant@users.sourceforge.net>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package genomemap.cef.pui;

import cef.event.Event;
import cef.pui.EventConstructionException;
import cef.pui.EventImpl;
import cef.pui.pob.Builder;
import genomemap.cef.event.ProcessComplDataEvent;
import genomemap.cef.pui.pob.Builders_Gen;
import genomemap.data.AssignmentData;
import genomemap.data.OrganismData;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * Implements {@code ProcessComplDataEvent} using the following properties.
 * <ul>
 * <li>{@code genomemap.builder.AssignmentData.url = assignmentdata:csv//URL }</li>
 * <li>{@code genomemap.builder.OrganismData.linkage-groups = comma separated linkage groups}</li>
 * <li>{@code genomemap.builder.OrganismData.url = organismdata:files//URL }</li>
 * </ul>
 *
 * @version 1.0.0
 * @author Susanta Tewari
 * @history Created on 12/20/2011
 * @since 1.0.0
 */
public final class ProcessComplDataEventImpl extends EventImpl implements ProcessComplDataEvent {

    /** Field description */
    private Builder<AssignmentData> assignment_data_builder;

    /** Field description */
    private Builder<OrganismData> organsim_data_builder;

    /**
     * Constructs ...
     *
     *
     * @param props
     *
     * @throws EventConstructionException
     */
    public ProcessComplDataEventImpl(final Properties props) throws EventConstructionException {

        super(props);

        super.processEventProperties(getImplementedEventInterfaces());

        assignment_data_builder = Builders_Gen.of_AssignmentData_File(props, null);
        organsim_data_builder   = Builders_Gen.of_Data_OrganismData_Dir(props, null);
    }

    /**
     * Method description
     *
     *
     * @param assignment_data_builder
     */
    public void setAssignmentDataBuilder(final Builder<AssignmentData> assignment_data_builder) {
        this.assignment_data_builder = assignment_data_builder;
    }

    /**
     * Method description
     *
     *
     * @param organism_data_builder
     */
    public void setOrgansimDataBuilder(final Builder<OrganismData> organism_data_builder) {
        this.organsim_data_builder = organism_data_builder;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    protected List<Class<? extends Event>> getImplementedEventInterfaces() {

        final List<Class<? extends Event>> result = new ArrayList<>(2);

        result.add(ProcessComplDataEvent.class);
        result.add(Event.class);

        return result;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    @Override
    public AssignmentData getAssignmentData() {
        return assignment_data_builder.build();
    }

    /**
     * @return input data used in analysis
     */
    @Override
    public OrganismData getOrganismData() {
        return organsim_data_builder.build();
    }
}
